package com.gexiaobao.pigeon.ui.adapter

import android.content.Context
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter

class MyPagerAdapter(
    fm: FragmentManager?, private val context: Context, private val fragmentList: MutableList<Fragment>, private val list_Title: List<String>
) : FragmentPagerAdapter(
    fm!!
) {
    fun clean() {
        fragmentList.clear()
        notifyDataSetChanged()
    }

    override fun getItem(position: Int): Fragment {
        return fragmentList[position]
    }

    override fun getCount(): Int {
        return list_Title.size
    }

    /**
     * //此方法用来显示tab上的名字
     *
     * @param position
     * @return
     */
    override fun getPageTitle(position: Int): CharSequence? {
        return list_Title[position]
    }
}